package ys.db2es.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@TableName("t_users")
public class User implements Serializable, IdAble {

    @JsonIgnore
    private Integer id;
    private String name;
    private String password;
    private String sex;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthday;
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date registTime;

    @JsonIgnore
    @Override
    public String getIdStr() {
        return String.valueOf(id);
    }

    @JsonIgnore
    @Override
    public void setIdStr(String idStr) {
        id = Integer.valueOf(idStr);
    }

}
